<?php

namespace App\Admin\Controllers;

use App\Models\Time;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Encore\Admin\Controllers\AdminController;

class TimesController extends AdminController
{
    protected $title = '过户次数管理';
    
    protected function grid()
    {
        $grid = new Grid(new Time());
	
	    $grid->disableExport();
	    
	    $grid->column('name', '标题');
        $grid->column('min', '最小过户次数');
        $grid->column('max', '最大过户次数');
	    $grid->column('order', '排序')->editable();
        return $grid;
    }
    
    protected function detail($id)
    {
        $show = new Show(Time::findOrFail($id));



        return $show;
    }
    
    protected function form()
    {
        $form = new Form(new Time());
	    $form->text('name', '标题');
	    $form->number('min', '最小过户次数')->min(0)->default(0);
        $form->number('max', '最大过户次数')->min(0)->default(999);
	    $form->number('order', '排序')->min(1)->default(1);
	   

        return $form;
    }

}
